<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>上传apk</title>
	<link rel="stylesheet" href="/css/layui.css">
  <script src="/layui.js"></script>
</head>
<body>
	<div class="layui-container">
		<form class="layui-form" action="" method="post">
    <div class="layui-form-item">
      <label class="layui-form-label">版本号</label>
      <div class="layui-input-block">
        <input type="text" name="version" required  lay-verify="required" placeholder="请输入版本号" autocomplete="off" class="layui-input">
      </div>
    </div>
    
    <div class="layui-form-item">
      <label class="layui-form-label">环境</label>
      <div class="layui-input-block">
        <select name="env" lay-verify="required">
          <option value="">请选择一个变量</option>
          <option value="P1">P1</option>
          <option value="P2">P2</option>
          <option value="正式">正式</option>
        </select>   
      </div>
    </div>
    <div class="layui-form-item layui-form-text">
      <label class="layui-form-label">版本描述</label>
      <div class="layui-input-block">
        <textarea name="description" placeholder="请版本描述" class="layui-textarea"></textarea>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">上传apk</label>
      <div class="layui-input-block">
        <button type="button" class="layui-btn" id="apk">
          <i class="layui-icon">&#xe67c;</i>上传文件
        </button>
        <input type="text" name="path" style="display: none" hidden="" required  lay-verify="required" placeholder="请输入版本号" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <div class="layui-input-block">
        <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
      </div>
    </div>
</form>
 
<script>
  layui.use(['form', 'upload'], function(){  //如果只加载一个模块，可以不填数组。如：layui.use('form')
  var form = layui.form //获取form模块
  ,upload = layui.upload; //获取upload模块
  
  //监听提交按钮
  form.on('submit(test)', function(data){
    console.log(data);
  });
  var uploadInst = upload.render({
    elem: '#apk' //绑定元素
    ,url: '/upload/apk' //上传接口
    ,accept:'file'
    ,done: function(res){
      //上传完毕回调
    }
    ,error: function(){
      //请求异常回调
    }
  });
});
</script>
      
	</div>
</body>
</html>